﻿@using RuoVea.ExUtil;

@using Microsoft.Extensions.Options

@{
    ViewData["Title"] = "作业";
    string JobRootUrl = "";
    Layout = "";
}
<!DOCTYPE html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@ViewData["Title"] - MES管理系统</title>
    <link href="/elementui/index.css" rel="stylesheet" />
    <link href="/elementui/index.extend.css?v=22" rel="stylesheet" />
    <style scoped>


    </style>
</head>
<body>

  
    <div id="main" v-cloak>


        <el-main>
            <el-row type="flex" align="center">
                <el-col :span="24" style="padding: 10px 0 0 0;">
                    <el-extend-table :columns="columns"
                    :tool-visible="false"
                    :table-data="tableData"
                    primary-key="name"
                    :load-data="loadData"
                    :handle-detail="handleEdit"
                    :handle-edit="handleEdit"
                    :handle-delete="handleDelete"
                    :page-sizes=[]
                    >
             @*            <el-table-column prop="createTime" label="CreationTime" width="160"></el-table-column>
                        <el-table-column prop="description" label="TaskDescription" min-width="250"></el-table-column>
                        <el-table-column prop="runTimes" label="runTimes" align="center" width="160"></el-table-column>
                        <el-table-column prop="nextFireTime" label="NextExecutionTime" width="160"></el-table-column>
                        <el-table-column prop="previousFireTime" label="LastExecutionTime" width="160"></el-table-column> *@
                </el-extend-table>
                </el-col>
            </el-row>
        </el-main>
        

    </div>

    <script type="text/javascript" src="/vue/vue.js?v=2.0"></script>
    <script type="text/javascript" src="/vue/vue-i18n.min.js?v=2.0"></script>
    <script type="text/javascript" src="/elementui/index.js"></script>
    <script type="text/javascript" src="/elementui/index.extend.js?v=@RuoVea.ExUtil.Time.Time.Now.GetTimeStamp()"></script>
    <script type="text/javascript" src="/vue/axios.min.js"></script>
    <script>Vue.prototype.$baseURL = "ruovea";</script>
    <script type="text/javascript" src="/vue/axios.min.extend.js?v=@RuoVea.ExUtil.Time.Time.Now.GetTimeStamp()"></script>
    <script>

      
    

        var $taskVue = new Vue({
            el: "#main",
            data() {
                return {
                    tableData: [
                        {
                            date: '2016-05-03',
                            name: 'Tom',
                            address: 'No. 189, Grove St, Los Angeles',
                        }, {
                            date: '2016-05-02',
                            name: 'Tom2',
                            address: 'No. 189, Grove St, Los Angeles2',
                        }, {
                            date: '2016-05-03',
                            name: 'Tom',
                            address: 'No. 189, Grove St, Los Angeles',
                        }, {
                            date: '2016-05-02',
                            name: 'Tom2',
                            address: 'No. 189, Grove St, Los Angeles2',
                        }, {
                            date: '2016-05-03',
                            name: 'Tom',
                            address: 'No. 189, Grove St, Los Angeles',
                        }, {
                            date: '2016-05-02',
                            name: 'Tom2',
                            address: 'No. 189, Grove St, Los Angeles2',
                        },{
                            date: '2016-05-03',
                            name: 'Tom',
                            address: 'No. 189, Grove St, Los Angeles',
                        }, {
                            date: '2016-05-02',
                            name: 'Tom2',
                            address: 'No. 189, Grove St, Los Angeles2',
                        },{
                            date: '2016-05-03',
                            name: 'Tom',
                            address: 'No. 189, Grove St, Los Angeles',
                        }, {
                            date: '2016-05-02',
                            name: 'Tom2',
                            address: 'No. 189, Grove St, Los Angeles2',
                        }, 
                    ],
                    columns: [
                        {
                            prop: "date",
                            label: "日期",
                            width: 180
                        },
                        {
                            prop: "name",
                            label: "姓名", textAlign: "center",
                            width: 180
                        },
                        {
                            prop: "address",showOverflowTooltip:true,
                            label: "地址"
                        },
                    ],
                    

                }
            },
            created() {
                // console.log(this.$http);
                // setInterval(() => { this.OnLoadJobs(); }, 10000);
            },
            mounted: function () {
                // this.OnLoadJobs();
            },
            methods: {
                handleDelete(e) {
                    var that = this;
                    console.log(e);
                        this.$http("@("/remove/")" + e.row.id).then(function (res) {
                            if (res.data.code == 200) {
                                that.$message({ message: res.data.message, center: true, type: 'success' });
                                rows.splice(index, 1);
                                that.loadData();
                            } else {
                                that.$message({ message: res.data.message, center: true, type: 'error' });
                            }
                        });
                    
                },
                handleEdit(e) {
                    console.log(e);
                    // 编辑操作的逻辑
                },
                loadData() {
                    var that = this;
                    that.loading = true;
                    this.post("@("/jobList")", that.tableQuery)
                        .then(function (res) {
                            that.tableData = res.data.data.rows;
                            that.tableQuery.totalRows = res.data.data.totalRows;
                            that.loading = false;
                        }).catch(function (res) { that.loading = false; });
                },


                addDialogForm() {
                    var that = this;
                    that.dialogFormVisible = true; that.dialogForm = null;
                    that.dialogForm = that.dialogInitForm;
                },
                editDialogForm(index, row) {
                    var that = this;
                    that.dialogFormVisible = true;
                    that.dialogForm = that.dialogInitForm;
                    axios("@("/" + JobRootUrl + "/getjob/")" + row.id).then(function (res) { if (res.data.code == 200) { that.dialogForm = res.data.data; } });
                },
                detail(index,key, row) { var that = this; window.location.href = "@("/" + JobRootUrl + "/log?id=")" + row.id; },
               
                
            },
            filters: {
                scheduleTypeTitle(data) {
                    return data.scheduleTypeText + ":" + data.runTypeText;
                }
            }
        });
    </script>
</body>
</>
